package itsm.isperp.control.form.process;

import itsm.isperp.framework.core.context.ContextHolder;

import java.util.Date;
import java.util.Map;

/**
 * 
 * 事件进度
 * 
 * @author lizx
 * @date 2013-10-19
 * @since 1.0
 * 
 */
public class IncidentProcesser {

	// public static final String[] INCIDENT_PROCESS_NODES = { "提交", "已分派",
	// "已响应",
	// "已到场", "已解决", "已关闭" };
	//
	// public static final String[] INCIDENT_PROCESS_NODE_FIELDS = {
	// "create_date", "assign_date", "response_date", "arrival_date",
	// "solved_date", "closed_date" };

	public static final String renrder(Map<String, Object> map) {

		String incidentStatus = ContextHolder.getConfigByKey("IncidentStatus");
		String incidentStatusDates = ContextHolder
				.getConfigByKey("IncidentStatusDates");

		String[] incidentStatusArr = incidentStatus.split(",");
		String[] incidentStatusDatesArr = incidentStatusDates.split(",");

		Processer p = new Processer();

		for (int i = 0; i < incidentStatusArr.length; i++) {

			String s = incidentStatusArr[i];
			p.addProcessNode(s, (Date) map.get(incidentStatusDatesArr[i]));
		}

		return p.renderHtml();
	}
}
